package com.oocl.server.main;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class Server implements Runnable {
	private int port;
	private ServerSocket serverSocket;
	private String filePath;

	public Server(int port,String filePath) {
		this.port = port;
		this.filePath = filePath;
	}

	public void run() {
		try {
			System.out.println("----Server start----");
			serverSocket = new ServerSocket(port);
			while (true) {
				Socket client = serverSocket.accept();
				
				if (client != null) {
					new Thread(new ServerChater(client,filePath)).start();
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
	
	public static void main(String[] args) {
		String filePath = "C:\\Users\\DAIGA\\Desktop\\ServerFolder";
		Server server = new Server(80,filePath);
		new Thread(server).start();
	}
	
}
